﻿package Modules.BulletinModule
{
	import Modules.CommunicationsModule.BulletinCommuncationModule;
	import Modules.MainTimeLine;
	import Modules.Utilities;
	
	public class BulletinFAQ
	{
		public var topicArray:Array; 			// what is the topic?
		public var questionArray:Array; 		// what is the question?
		public var questionTopicArray:Array; 	// what topic the question belongs to?
		public var answerArray:Array; 			// what is the answer to question?
		
		public function BulletinFAQ()
		{
			topicArray = new Array();
			questionArray = new Array();
			questionTopicArray = new Array();
			answerArray = new Array();
			
			BulletinCommuncationModule.getBulletinFAQ();
		}

		// set bulletin faq into array and in ui
		public function setBulletinFAQ(loadedData:Array){
			var j:int = 0;
			var i:int = 0;
			
			// go through topic
			while(j<loadedData.length){
				
				topicArray.push(loadedData[j].topicName);
				
				// go through all questions
				while(j < loadedData.length && i == loadedData[j].topicIndex){
					questionTopicArray.push(i);
					questionArray.push(loadedData[j].question);
					answerArray.push(loadedData[j].answer);
					
					j++;
				}
				
				i++;
			}
		}
	}
}